<template>
  <el-dialog v-model="visible" title="任务日志详情" width="50%">
    <el-descriptions :column="1" border>
      <el-descriptions-item label="ID">{{ detail?.id }}</el-descriptions-item>
      <el-descriptions-item label="关联任务">{{ detail?.task?.name }}</el-descriptions-item>
      <el-descriptions-item label="目标URL">{{ detail?.target_url }}</el-descriptions-item>
      <el-descriptions-item label="响应状态">{{ detail?.response_status }}</el-descriptions-item>
      <el-descriptions-item label="错误信息">{{ detail?.response_error }}</el-descriptions-item>
      <el-descriptions-item label="创建时间">{{ detail?.created_at }}</el-descriptions-item>
    </el-descriptions>
  </el-dialog>
</template>

<script lang="ts" setup>
import { computed } from "vue";
import { type TaskLogType } from "@/api/task/log";

const props = defineProps<{
  modelValue: boolean;
  detail: TaskLogType | null;
}>();

const emit = defineEmits(["update:modelValue"]);

const visible = computed({
  get: () => props.modelValue,
  set: (val) => emit("update:modelValue", val),
});
</script>
